function delay(durtion) {
  return new Promise((resolve, reject) => {
    setTimeout(() => {
      reject('错误');
    }, durtion);
  });
}

async function main() {
  for (let i = 0; i < 5; i++) {
    try {
      await delay(1000);
      console.log('ok');
    } catch (error) {
      console.log(error);
    }
  }
}
main();
